<template>
	<basic-container>
		<avue-sign ref="sign"></avue-sign>
		<el-button type="primary" @click="handleSubmit">生成</el-button>
		<el-button type="danger" @click="$refs.sign.getStar('这里是用途','这里是单位的名称','123456')">图章</el-button>
		<el-button @click="$refs.sign.clear()">清空</el-button>
		<el-button @click="submit" type="primary">全局水印</el-button>
		<el-button type="primary" @click="handleExcel">下载 excel</el-button>
		<div>
			<br />
			结果
			<img :src="img" alt="" width="80" height="50" />
		</div>
	</basic-container>
</template>

<script>
	export default {
		data() {
			return {
				img: ''
			}
		},
		methods: {
			handleSubmit() {
				this.img = this.$refs.sign.submit(80, 50);
				console.log(this.img)
			},
			submit() {
				this.$message.success('添加水印成功')
				this.watermark({
					text: 'avue全局水印演示'
				})
			},
			handleExcel() {
				let opt = {
					title: '文档标题',
					column: [{
						label: '标题',
						prop: 'title'
					}],
					data: [{
						title: "测试数据1"
					}, {
						title: "测试数据2"
					}]
				}
				this.$export.excel({
					title: opt.title || new Date().getTime(),
					columns: opt.column,
					data: opt.data
				});
			}
		}
	}
</script>

<style>
</style>
